<div role="dialog" class="modal fade" id="collection-list-container" tabindex="-1" aria-labelledby="col_add_title" >
  <div class="modal-dialog">
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
          <span class="modal-title" id="col_add_title"><%= t("sufia.collection.select_form.title") %></span>
        </div>
        <div class="modal-body">
          <% if user_collections.blank? %>
            <em> <%= t("sufia.collection.select_form.no_collections") %></em><br><br><br><br>
          <% else %>
            <div class="collection-list">
              <fieldset>
                <legend><%= t("sufia.collection.select_form.select_heading") %></legend>
              <ul>
                <% user_collections.sort { |c1,c2| c2[CatalogController.uploaded_field] <=> c1[CatalogController.uploaded_field] }.each_with_index do |collection,index|  %>
                  <li>
                    <% selected = (collection.id == @add_files_to_collection) || (@add_files_to_collection.blank? && index == 0) %>
                    <%= radio_button_tag(:id, collection.id, selected, class: "collection-selector") %>
                    <%= label_tag(:collection, collection.title_or_label, for: "id_#{collection.id}") %>
                  </li>
                <% end %>
              </ul>
              </fieldset>
            </div><!-- collection-list -->
          <% end %> <!-- else -->
        </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal"><%= t("sufia.collection.select_form.close")%></button>
          <% if user_collections.blank? %>
            <%= render '/collections/button_create_collection', label: t("sufia.collection.select_form.create") %>
            
          <% else %>
            <%= render '/collections/button_for_update_collection', label: t("sufia.collection.select_form.update"), collection_id: 'collection_replace_id' %>
            <%= render '/collections/button_create_collection', label: t("sufia.collection.select_form.create_new") %>
          <% end %>
        </div>
      </div><!-- /.modal-content -->
  </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
